/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package nueva.esperanza.dao.impl;

import java.io.Serializable;
import nueva.esperanza.dao.ChequeraSvc;
import nueva.esperanza.exception.BDError;
import nueva.esperanza.exception.DaoException;
import nueva.esperanza.modelo.Chequera;
import org.apache.log4j.Logger;
import org.springframework.transaction.annotation.Transactional;

/**
 *
 * @author mgcharuc
 */
public class ChequeraImpl extends DaoImpl<Long, Chequera> implements ChequeraSvc, Serializable {

    private static final Logger log = Logger.getLogger(ChequeraImpl.class);

    @Transactional(rollbackFor = {Exception.class})
    public void guardar(Chequera objetoChequera) throws BDError {
        try {
            persist(objetoChequera);
        } catch (DaoException ex) {
            log.error("Error al persistir chequera");
            throw new BDError("Error al persistir chequera", ex);
        }
    }

    @Transactional(rollbackFor = {Exception.class})
    public void actualizar(Chequera objetoChequera) throws BDError {
        try {
            update(objetoChequera);
        } catch (DaoException ex) {
            log.error("Error al actualizar chequera");
            throw new BDError("Error al actualizar chequera", ex);
        }
    }
}
